import axios from '../axios';

export const messageApi={
    //获取用户消息
    getMessage:(data)=>{
        return axios.get('/receive/getmsglist',{params:data})
        .then(response => response.data)
        .catch(error => {
            throw new Error(error);
        });
    },
    getMessagePage:(data)=>{
         return axios.get('/receive/getmsglistpage',{params:data})
        .then(response => response.data)
        .catch(error => {
            throw new Error(error);
        });
    },
    //获取uid发送给当前账号的消息
    getMessagePageToMe:(data)=>{
         return axios.get('/receive/getmsglist/page',{params:data})
        .then(response => response.data)
        .catch(error => {
            throw new Error(error);
        });
    },
    //发送消息
    sendMessage:(data)=>{
          return axios.post('/receive/sendmsg',data)
        .then(response => response)
        .catch(error => {
            throw new Error(error);
        });
    },
    //获取消息发送记录
    getMessageRecordPageToUid:(data)=>{
         return axios.get('/receive/record/getmsgpage/touid',{params:data})
        .then(response => response.data)
        .catch(error => {
            throw new Error(error);
        });
    }
}